package ModelLayer;
import java.util.ArrayList;


/**
 * Write a description of class DVDContainer here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class DVDContainer
{
    // instance variables
    private ArrayList<DVD> d;

    public DVDContainer()
    {
        d = new ArrayList<DVD>();
    }

    public void addDVD(DVD d)
    {
        this.d.add(d);
    }
    public DVD readDVD(String title)
    {
        DVD d = getDVD(title);
        return d;
    }
    public void removeDVD(DVD d)
    {
        this.d.remove(d);
    }
    public DVD getDVD(String title)
    {
        int index = 0;
        while(d.size()> index)
        {
            DVD dvds = d.get(index);
            if(dvds.getTitle().contains(title))
            {
                return dvds;
            }
            index++;
        }
        return null;
    }
    public ArrayList<DVD> listAllDVDs()
    {
        return d;
    }
}
